<?php

use backend\widgets\Bar;
use backend\grid\CheckboxColumn;
use backend\grid\ActionColumn;
use backend\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title                   = 'User Items';
$this->params['breadcrumbs'][] = yii::t('app', 'User Item');
?>
<div class="row">
    <div class="col-sm-12">
        <div class="ibox">
            <?= $this->render('/widgets/_ibox-title') ?>
            <div class="ibox-content">
                <?= Bar::widget() ?>
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'columns'      => [
                        ['class' => CheckboxColumn::className()],

                        [
                            'attribute' => 'name',
                            'label'     => '权限名',

                        ],
                        [
                            'attribute' => 'type',
                            'label'     => "类型",
                            'value'     => function ($model) {
                                return \common\libs\Constants::getUserItemType($model->type);
                            }
                        ],
                        [
                            'attribute' => 'description',
                            'label'     => "描述",
                            'format'    => 'text',

                        ],
                        [
                            'attribute' => 'rule_name',
                            'label'     => "规则名",
                        ],
//                        'data',
                        // 'created_at',
                        // 'updated_at',

                        ['class' => ActionColumn::className(),],
                    ],
                ]); ?>
            </div>
        </div>
    </div>
</div>
